<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <!-- 确保适当的绘图比例 -->
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- 页面标题 -->
    <title>csdn下载器</title>
    <!-- CSS 样式 -->
    <style>
        /* 页面基础样式 */
        body, html {
            margin: 0;
            padding: 0;
            height: 100%;
            font-family: 'Segoe UI', Arial, sans-serif;
            background: linear-gradient(to right, #74ebd5, #ACB6E5);
            display: flex;
            justify-content: center;
            align-items: center;
            text-align: center;
        }

        /* 容器样式 */
        .container {
            background: white;
            padding: 2rem;
            border-radius: 1rem;
            box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
        }

        /* 输入框样式 */
        input[type="text"] {
            width: 100%;
            padding: 1rem;
            margin: 1rem 0;
            border: 1px solid #ccc;
            border-radius: 0.5rem;
        }

        /* 下载选项样式 */
        .download-option {
            margin-bottom: 1rem;
        }

        label {
            cursor: pointer;
            padding: 0.5rem 1rem;
        }

        /* 选项按钮样式 */
        .option-button {
            display: inline-block;
            padding: 0.5rem 1rem;
            color: white;
            background-color: #74ebd5;
            border: 0;
            border-radius: 2rem;
            margin: 0 0.5rem;
            box-shadow: inset 0 0 3em rgba(0,0,0,0.1), 0 0 1em white;
            transition: background-color 300ms ease-out;
        }

        .option-button:hover {
            background-color: #a2d9ce;
        }

        .option-button.active {
            background-color: #ACB6E5;
        }

        /* 下载按钮样式 */
        #downloadBtn {
            display: inline-block;
            padding: 1rem 2rem;
            color: white;
            background: #8A78E4;
            border: none;
            border-radius: 2rem;
            cursor: pointer;
            transition: background-color 300ms ease-out;
        }

        #downloadBtn:hover {
            background: #9C8FEF;
        }

        /* 响应式设计 */
        @media (max-width: 768px) {
            .container {
                width: 90%;
                padding: 1rem;
            }

            .option-button, #downloadBtn {
                padding: 0.75rem 1.5rem;
            }
        }
    </style>
</head>
<body>
<div class="container">
    <!-- 标题 -->
    <h2>请选择您的下载选项</h2>
    <!-- 输入框 -->
    <input type="text" id="csdnLink" placeholder="请输入链接...">
    <!-- 下载单篇或全部选择区 -->
    <div class="download-option">
        <label id="singleLabel" class="option-button active" onclick="setDownloadOption('single')">单篇文章</label>
        <label id="allLabel" class="option-button" onclick="setDownloadOption('all')">所有文章</label>
    </div>
    <!-- 下载按钮 -->
    <button id="downloadBtn">下载</button>
</div>

<script>
    let downloadOption = 'single'; // 默认下载选项

    // 设置下载选项
    function setDownloadOption(option) {
        downloadOption = option;
        document.getElementById('singleLabel').classList.remove('active');
        document.getElementById('allLabel').classList.remove('active');

        const optionLabel = option === 'single' ? 'singleLabel' : 'allLabel';
        document.getElementById(optionLabel).classList.add('active');

        const csdnLinkInput = document.getElementById('csdnLink');
        csdnLinkInput.placeholder = option === 'single' ? '请输入CSDN文章链接...' : '请输入CSDN用户链接...';
    }

    // 下载按钮事件
    document.getElementById('downloadBtn').addEventListener('click', function() {
        const csdnLink = document.getElementById('csdnLink').value;
        if (!csdnLink) {
            alert('请先输入链接！');
            return;
        }
        console.log(`开始下载${downloadOption === 'single' ? '单篇' : '所有'}文章，链接: ${csdnLink}`);
        // 实现下载功能的代码以此处为钩子
    });

    // 初始化页面与事件绑定
    document.addEventListener('DOMContentLoaded', function() {
        setDownloadOption('single'); // 默认选项
    });
</script>
</body>
</html>